package ControlLayer;
import java.util.ArrayList;
import ModelLayer.*;

/**
 * Write a description of class LoanCtr here.
 * 
 * @author (your name) 
 * @version (a version number or a date)
 */
public class LoanCtr
{
    // instance variables - replace the example below with your own
   private LoanContainer loCtr;
   private DVDCtr dvCtr;
   private AddressCtr addCtr;

    /**
     * Constructor for objects of class LoanCtr
     */
    public LoanCtr()
    {
      loCtr = LoanContainer.getInstance();
      dvCtr = new DVDCtr();
      addCtr = new AddressCtr();
    }
    
    public void searchPersonDvd(long id)
    {
        
        //loCtr.listPerson(id);
        addCtr.listPerson(id);        
    }
    
    public void listEksemplarFromId(long id)
    {
        dvCtr.listEksemplarFromId(id);
    }
    public void searchEksemplar(String serienr)
    {
         //loCtr.listEksemplar(serienr);
         dvCtr.searchEksemplar(serienr);
    }
    
 /*   public void listAll(long id)
    {
        loCtr.listAll(id);
    }
  */  
    public void searchDvd(long id)
    {
       dvCtr.findDVD(id);
    }
    
    public void createLoan(long id, String dato, String period, String status)
    {
        
        Loan loan = new Loan(id, dato, period, status);
        loCtr.addLoan(loan);
    }
    
 /*   public void createPerson(long id, String name, String address, String postalCode, String city, String tlf)
     {
         Person per = new Person(id, name, address, postalCode, city, tlf);
         loCtr.addPerson(per);
     }
 */   
     public void searchLoan(long id, String status)
     {
         loCtr.searchLoan(id,status);
     }
     
     public void findLoan(long no)
     {
         loCtr.listLoan(no);
     }
     
/*     public void listLoans()
     {
         loCtr.listLoans();
     }
*/     
     public void removeCopy(String serienr)
     {
         
         dvCtr.deleteEksemplar(serienr);
         
     }
     
     public void listAll(long id)
     {
         dvCtr.listAll(id);
     }
    }